import urllib, os

urls="""
http://www.seccion36.org.mx 
http://www.metacryption.com 
http://sitescraper.net 
http://www.krasimira.net 
http://radbox.com
http://repo.arch-linux.pl/
http://my-sticky-note.appspot.com
http://hipercenter.com/
http://www.whitepeaksoftware.com/
http://www.norterural.com.ar/norterural/
http://www.jwfind.net/
http://web2py.iiit.ac.in/publications/
http://www.qualitysystems.com
http://www.zgus.com/
http://www.techfuel.net/
http://wavedirectory.appspot.com/
http://www.julioflores.com/zblog/default/index
http://fightalzheimers.appspot.com
http://www.web2pyslices.com/main/default/index
http://www.web2py.com/mc4qcd
http://pyforum.org/
http://w2popenid.appspot.com/init/default/wiki/main
http://www.web2py.com/survey/survey/index
http://www.icoexist.org
http://www.tecnicon.pt
http://paste.pagenoare.net/
http://paneido.com 
http://diarywiz.com 
http://aion-info.appspot.com 
http://www.futurelogic.com/
http://thadeusb.com/
http://www.semanticsbml.org/aym/ 
http://y-a-t-s-y.appspot.com/
http://web2py.tenthrow.com
https://us.pycon.org/2010/register/
http://www.sahanapy.org/
http://auctionall.info/hausstand/default/index
http://designer.bojanka.net/
http://www.onemewebservices.com
http://www.elizabethscanvas.org/
http://www.qakit.com/
http://ru.ly/ 
http://elizabethscanvas.org
http://arritmia.bressol.org
http://voiceofaccess.org/
http://www.flockbird.com 
http://www.flockbird.com:9065/Flockbird/default/bug_dashboard
http://campus.visie.com.br/default/index
http://www.whitepeaksoftware.com/ 
http://ga2arch.appspot.com 
http://www.quadraforte.com 
http://openshare.emotionull.com 
http://repo.arch-linux.pl 
http://fightalzheimers.appspot.com 
http://www.zgus.com/ 
http://www.professionalit.com.br 
"""


def make_thumb(url,path):
    data=urllib.urlopen('http://api.thumbalizr.com/?url=%s&width=250&api_key=268612f8574224b5744d6762fbdf4f55' % url).read()
    print url
    filename=url.split('/')[2]+'.jpg'
    open(os.path.join(path,filename),'wb').write(data)

for url in urls.split('\n'):
    url=url.strip()
    if url:
        print url
        make_thumb(url,'../static/thumbnails')
